/* 通用布局 */
const name = window.location
console.log('name=-=-=-=-=-=-=-=-=-', window.location)
Vue.component('layout', {
  template: `
    <div class="main-layout">
      <slot />
      <my-footer />
      <div id="msg"></div>
    </div>
  `,
  props: {
    white: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      info: {},
      visible: false,
    }
  },
  components: {
    myFooter: httpVueLoader('./components/footer.vue'),
    mainMenu: httpVueLoader('./components/menu.vue')
  },
  methods: {
    open() {
      this.visible = true
      console.log('success')
    },
  },
  mounted() {
    var info = window.info()
    info.phone = info.tel.replace(/\-/g, '')
    this.info = info;
  }
});


/* 通用导航吸顶 */
Vue.component('module', {
  template: `
    <div>
      <div class="ny-header study-recommend">
        <div class="bg"></div>
        <div class="menu-list">
          <ul class="menu-list-flex">
            <li 
              v-for="(item, index) in navs" 
              :key="index" 
              :data-id="'main' + (index + 1)" 
              class="li flex-ct" 
              :class="'menu-item' + index + (index === 0 ? ' active' : '')"
            >{{item}}</li>
          </ul>
        </div>
      </div>
      <div v-for="(item, index) in navs" :key="index" :id="'main' + (index + 1)" class="container">
        <slot :name="'main' + (index + 1)" :title="item" />
      </div>
    </div>
  `,
  props: ['navs'],
  mounted() {
    this.$nextTick(() => {
      var container = $('.container');
      menuScroll(container);
    })
  }
});